package boundary;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;   


/**
 * The Class MainWindow.
 */
public class MainWindow extends JPanel implements ActionListener{

	private static final long serialVersionUID = 1L;
	private JFrame frame = new JFrame("We are josh's family");
	private JPanel panel= new JPanel();
	private JTextArea option=new JTextArea();
        
	private    JButton chinese = new JButton("Chinese");
	private    JButton english = new JButton("English");

    boolean ischinese;
    
    public MainWindow() {
    	option.setBackground(SystemColor.control);
    	option.setText("Select Language"+"\n"+"Select Chinese"+"\n");
    	panel.add(option);
        panel.add(chinese);
        panel.add(english);
       
        chinese.addActionListener(this);
        english.addActionListener(this);
        frame.setLocationRelativeTo(null);
        
        frame.setContentPane(panel);
        
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setSize(800,800);
        
        frame.setVisible(true);
   }

    public void actionPerformed(ActionEvent action) {
                JButton selected = (JButton)action.getSource();
        if(selected==chinese){
        	ischinese=true;
        	new HowMany(frame,ischinese);

        }else if(selected==english){
        	ischinese=false;
        	new HowMany(frame,ischinese);
        }
        
    }
    
    public static void main(String[] args) {
       new MainWindow();
    }
}